package com.example.xzc.cainiaoshangcheng.Activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.example.xzc.cainiaoshangcheng.Adapter.Test3Adapter;
import com.example.xzc.cainiaoshangcheng.Bean.Test3Bean;
import com.example.xzc.cainiaoshangcheng.R;
import com.example.xzc.cainiaoshangcheng.widget.FullyLinearLayoutManager;

import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

/**
 * @projectName: CaiNiaoShangCheng    ---------> 项目名称
 * @description: --------->描述
 * @author: xzc                              --------->作者
 * @date: 2017-03-14    --------->日期
 * @time: 15:45               --------->时间
 */

public class Test3Activity extends AppCompatActivity {

    @ViewInject(R.id.rv_test3)
    private RecyclerView rv_test3;

    private List<Test3Bean> datas;
    private Test3Adapter myAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test3);

        x.view().inject(this);

        initData();
        initView();


    }

    private void initData() {
        datas = new ArrayList<>();
        for(int i=0; i<50; i++){
            Test3Bean bean = new Test3Bean();
            String name = "name"+i;
            boolean isCheck = false;
            bean.setName(name);
            bean.setCheck(isCheck);
            datas.add(bean);
        }
    }

    private void initView() {
        rv_test3.setLayoutManager(new FullyLinearLayoutManager(this,FullyLinearLayoutManager.VERTICAL,false));
        myAdapter = new Test3Adapter(datas,this);
        rv_test3.setAdapter(myAdapter);
    }
}
